import React, { useEffect, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux'

import { fetchJobList } from './redux-saga/actions.js'
import { putJobList } from './redux-saga/reducers.js'

const MyCounter = (props) => {
  const [name, setName] = useState();
  const job = useSelector(state => state.job.dataList)
  console.log('job:', job)
  const dispatch = useDispatch()

  return (
    <div>
    <button
      aria-label="Increment value"
      onClick={() => {
        // dispatch(fetchJobList())
        dispatch(putJobList([1,2,3]))
      }}
    >
      Increment
    </button>
    <span>{job}{'haha'}</span>
    <button
      aria-label="Decrement value"
      // onClick={() => dispatch(decrement())}
    >
      Decrement
    </button>
  </div>
  );
};

const PageTest = (props) => {
  const dispatch =  useDispatch()
  useEffect(() => {
    // 
   


    // fetchJobListAPI().then((result) => {
    //   console.log('result3:', result)
    // })
  }, [])


    return (
        <div>
            Page 1
            <MyCounter/>
        </div>
    );
};

export default PageTest;